﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WCFMINERP.BLL.LatticePartition;
using WCFMINERP.Contracts.DataContracts;
using WCFMINERP.Contracts.InterFaces;

namespace WCFMINERP.Services.LatticePartition
{
    public class LatticePartitionServer : ILatticePartition
    {
        LatticePartitionBll _PartitionBll = new LatticePartitionBll();

        /// <summary>
        /// 根据工厂id获取格子分区
        /// </summary>
        /// <param name="oupshopid"></param>
        /// <returns></returns>
        public List<Contracts.DataContracts.LatticePartition> GetLatticePartitionList(int oupshopid)
        {
           return  _PartitionBll.GetLatticePartitionList(oupshopid);
        }

        /// <summary>
        /// 获取当前格子
        /// </summary>
        /// <param name="oupshopid"></param>
        /// <param name="pid"></param>
        /// <returns></returns>
        public Contracts.DataContracts.LatticePartition GetLatticePartitionModel(int oupshopid, int pid)
        {
            return _PartitionBll.GetLatticePartitionModel(oupshopid, pid);
        }

        /// <summary>
        /// 添加一条格子分区记录
        /// </summary>
        /// <param name="models"></param>
        /// <returns></returns>
        public int AddLatticePartition(Contracts.DataContracts.LatticePartition models)
        {
            return _PartitionBll.AddLatticePartition(models);
        }

        /// <summary>
        /// 删除一条格子分区记录
        /// </summary>
        /// <param name="Pid"></param>
        /// <returns></returns>
        public int DeleteLatticePartition(int Pid)
        {
            return _PartitionBll.DeleteLatticePartition(Pid);
        }

        /// <summary>
        /// 修改一条格子分区记录
        /// </summary>
        /// <param name="models"></param>
        /// <returns></returns>
        public int UpdateLatticePartition(Contracts.DataContracts.LatticePartition models)
        {
            return _PartitionBll.UpdateLatticePartition(models);
        }

        /// <summary>
        /// 根据工厂id,修改当前正在使用的格子
        /// </summary>
        /// <param name="models"></param>
        /// <returns></returns>
        public int UpdateLatticePartitionState(Contracts.DataContracts.LatticePartition models)
        {
            return _PartitionBll.UpdateLatticePartitionState(models);
        }

        /// <summary>
        /// 扫描产品code
        /// </summary>
        /// <param name="code"></param>
        /// <param name="mess"></param>
        /// <returns></returns>
        public int ScanningOrderInfoCode(int OperateUid, int techId,string code, int pid, out Lattice latticemodel, out string mess)
        {
            return _PartitionBll.ScanningOrderInfoCode(OperateUid,techId,code,pid,out latticemodel,out mess);
        }

        /// <summary>
        /// 清空格子
        /// </summary>
        /// <param name="LatticeID"></param>
        /// <param name="mess"></param>
        /// <returns></returns>
        public int emptyLattice(int LatticeID, out string mess)
        {
            return _PartitionBll.emptyLattice(LatticeID, out mess);
        }

        /// <summary>
        /// 根据订单ID获取当前订单信息
        /// </summary>
        /// <param name="orderid"></param>
        /// <param name="mess"></param>
        /// <returns></returns>
        public OrderBagInfo GetOrderBag(int orderid, out string mess)
        {
            return _PartitionBll.GetOrderBag(orderid,out mess);
        }

        public Lattice GetLatticeInfo(int Latticeid)
        {
            return _PartitionBll.GetGridInfo(Latticeid);
        }
    }
}
